$(document).ready(function () {
    function init() {
        $.ajax({
            "url":"./Home",
            "type": "POST",
            "dataType": "json",
            "success": function(data){
                var $con = $(".content").empty();
                $con.append("<tr>\n" +
                    "  <td>图书名称</td><td>作者</td><td>类别</td><td><a>查看详情</a></td>"+"</tr>");
                    for (var i=0;i<data.length;i++){
                    $con.append("<tr>" +
                        "<td>"+data[i].bookName+"</td>" +
                        "<td>"+data[i].bookAuthor+"</td>" +
                        "<td>"+data[i].bookType+"</td>"+
                        "<td><a href=''>查看详情</a></td>"+
                        "</tr>");
                }
                $('tr:odd').css('backgroundColor', '');
                $('tr:even').css('backgroundColor', 'red');
            }
        });
    }
    init();
});